<template>
  <div class="main w clearfix">
    <VideoInfo v-for="video in videoList" :key="video.id" :video="video" />
  </div>
</template>

<script setup lang="ts">
import VideoInfo from '@/components/VideoInfo.vue'
import { useVideoStore } from '@/stores'
import { computed, onMounted } from 'vue'

const store = useVideoStore()
onMounted(() => {
  store.getVideoList()
})

let fondList = JSON.parse(<string>localStorage.getItem('fondList')) || []
let videoList = computed(() => store.videoList)
videoList.value.forEach(video => {
  video['isFond'] = fondList.indexOf(video.id) >= 0
})
</script>

<style lang="less" scoped>
.main {
  margin-top: 30px;
}
</style>
